<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>用户信息</title>
    <%
        /********** 保存网站的基本路径 ***********/
        String path = request.getContextPath();
        String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
                + path + "/";
        //将该路径地址缓存到 session中 ,例如：http://localhost:8090/tjnu_ssh_1128/
        session.setAttribute("mybasePath", basePath);
    %>
    <!-- CSS -->
    <jsp:include page="../include/headtag.jsp" />
    <!-- <link rel="stylesheet"
        href="http://fonts.googleapis.com/css?family=Roboto:400,100,300,500"> -->
    <link rel="stylesheet"
          href="${mybasePath}assets/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="${mybasePath}assets/css/form-elements.css">
    <link rel="stylesheet" href="${mybasePath}assets/css/style.css">

</head>
<body>
<jsp:include page="../include/head1.jsp" />
<jsp:include page="../include/menu1.jsp" />
<div id="page-wrapper" style="margin-top: 50px;">
    <div id="page-inner">
        <div class="row">
            <div class="col-md-12">
                <h3 class="text-left">用户中心</h3>
            </div>
        </div>
        <hr />
        <ul class="nav nav-tabs">
            <li class="active"><a href="#order" data-toggle="tab">用户信息</a></li>
        </ul>
        <br>
        <div id="myTabContent" class="tab-content">
            <div class="tab-pane fade active in text-left" id="order">
                <div class="col-md-12">
                    <!-- <div class="col-md-3"> -->
                    <p class="text-left">
                        <font color="#eb6864">用户信息</font>
<%--                        <button onclick="run();">查询</button>--%>
                    </p>
                    <!-- </div> -->
                </div>

                <table class="table table-striped table-hover ">
                    <thead>
                    <tr>
                        <th>编号</th>
                        <th>姓名</th>
                        <th>性别</th>
                        <th>邮箱</th>
                        <th>手机</th>
                        <th>最后登录时间</th>
                        <th>操作</th>

                    </tr>
                    </thead>
                    <tbody>
                    <c:forEach var="commonUsers" items="${commonUsers}">
                        <tr>
                            <td>${commonUsers.userId}</td>
                                <%-- <td><a href="<c:url value='/officeInfoShow/${off.id}' />">${orderRecords.transactDate }</a></td> --%>
                            <td>${commonUsers.userName }</td>
                            <td>${commonUsers.userSex }</td>
                            <td>${commonUsers.userEmail }</td>
                            <td>${commonUsers.userMobile }</td>
                            <td>${commonUsers.lastLoginTime}</td>
                            <td><button  onclick="fun(${commonUsers.userId});">编辑</button></td>
                        </tr>
                    </c:forEach>
                    </tbody>
                </table>
            </div>
            <script>
                function fun(aa)
                {

                    window.location.href="${pageContext.request.contextPath}/uni/updateuser?userId="+aa;
                }

            </script>
        </div>

    </div>
</div>

</div>

</div>

<!-- /. PAGE INNER  -->
</div>
<!-- /. PAGE WRAPPER  -->

</body>
<!-- Javascript -->
    <script src="${mybasePath}assets/bootstrap/js/jquery.min.js"></script>
    <script src="${mybasePath}assets/js/jquery.backstretch.min.js"></script>
    <script type="text/javascript">
        $(function() {
            $("#updateSexButton")
                .click(
                    function() {
                        $
                            .post(
                                "/ssm_pro/updateSex",
                                {
                                    'userSex' : $("#userSex").val()
                                },
                                function(result) {
                                    if (result.userSexInfo != "") {

                                        if (result.userSexInfo == "男") {
                                            alert("修改成功");
                                            var userSexInfo = '<option value="男">男</option>';
                                            userSexInfo += '<option value="女">女</option>'
                                            $(
                                                "select[name='userSex']")
                                                .empty()
                                                .append(
                                                    userSexInfo);
                                        } else {
                                            alert("修改成功");
                                            var userSexInfo = '<option value="女">女</option>';
                                            userSexInfo += '<option value="男">男</option>';
                                            $(
                                                "select[name='userSex']")
                                                .empty()
                                                .append(
                                                    userSexInfo);
                                        }
                                        /* var noticeTypes = '<option value="-1">请选择</option>';
                                        $.each(result.noticeTypes, function(i,item){

                                            noticeTypes += '<option value="'+item.id+'">'+item.dictionaryValue+'</option>';
                                        });

                                        $("select[name='noticeTypeId']").empty().append(noticeTypes); */
                                    }
                                });
                    });
        });
    </script>
    <script type="text/javascript">
    function cancel() {
        $("#cancel").submit();
        return false;
    }
</script>
</html>